home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GEMFUNCS / OBJFLCHG.C < prev    next >
C/C++ Source or Header  |  1993-03-20  |  2KB  |  56 lines

  1. /**************************************************************************
  2.  * OBJFLCHG.C - Change object options, with optional redraw.
  3.  *************************************************************************/
  4.  
  5. #include "gemfintl.h"
  6.  
  7. #ifdef GEMFAST_PROTOS
  8.   void obj_flchange(OBJECT *ptree, short object, short newflags,
  9.                     short drawflag, ...)
  10. #else
  11.   void obj_flchange(ptree, object, newflags, drawflag)
  12.     register OBJECT *ptree;
  13.     short              object;
  14.     short              newflags;
  15.     short              drawflag;
  16. #endif
  17. {
  18.     GRECT            *optional_clip; /* present only if drawflag==OBJ_CLIPDRAW          */
  19.     GRECT            clip_rect;
  20.     va_list         args;
  21.  
  22.     va_start(args, drawflag);
  23.     optional_clip = va_arg(args, GRECT *);
  24.     va_end(args);
  25.  
  26. /*
  27.  * check the newflags value. if the high bit is set, AND the newflags
  28.  * with the current options, else OR them.
  29.  */
  30.  
  31.     if (newflags & 0x8000) {
  32.         ptree[object].ob_flags &= newflags;
  33.     }
  34.     else {
  35.         ptree[object].ob_flags |= newflags;
  36.     }
  37.  
  38. /*
  39.  * if drawflag is true, we need to do a redraw starting at the changed
  40.  * object's tree root (this is in case the HIDETREE flag is being changed),
  41.  * but the redraw must be clipped by the object we're trying to update.
  42.  * if the drawflag indicates a clipping rectangle was passed, the object's
  43.  * rectangle is clipped to it.
  44.  */
  45.  
  46.     if (drawflag) {
  47.         obj_clcalc(ptree, object, &clip_rect, NULL);
  48.         if (drawflag == OBJ_CLIPDRAW) {
  49.             rc_intersect(optional_clip, &clip_rect);
  50.         }
  51.         objc_draw(ptree, R_TREE, MAX_DEPTH, RECTVALS(&clip_rect));
  52.     }
  53. }
  54.  
  55.  
  56.